<?php
/* 采购单 */
class SourcingModel extends BaseModel
{
    var $table  = 'sourcing_list';			//表名
    var $prikey = 'list_id';		//主键
    var $_name  = 'sourcing';			//查询用表名
	
	//模型关联
    var $_relation = array(
		'has_item' => array(
			'model' => 'sourcingitem',
			'type' => HAS_MANY,
            'foreign_key'   => 'list_id',
            'dependent'     => true
		),
		'belongs_sample' => array(
			'model' => 'sample',
			'type' => BELONGS_TO,
            'foreign_key'   => 'sample_id',
            'reverse'       => 'has_sourcing',
		),
		'belongs_sourcing' => array(
			'model' => 'member',
			'type' => BELONGS_TO,
			'foreign_key' => 'user_id',
			'reverse' => 'has_sourcing_list',
		),
	);
	
}

?>